package com.oocl.dataprocess.filter.Impl;

import java.util.ArrayList;

import com.oocl.analyze.Analyze;
import com.oocl.dataprocess.filter.Filter;
import com.oocl.dataprocess.pojo.Customer;
import com.oocl.dataprocess.regx.Regx;

public class FilterRex implements Filter {
	Analyze analyze = new Analyze();



	public ArrayList<Customer> filterWrong(ArrayList<Customer> list) {
		ArrayList<Customer> newList = new ArrayList<Customer>();
		Boolean flagDate = false;
		Boolean flagEmail = false;
		
		for(Customer customer:list){
			
			flagDate = analyze.analyzeCorrectness(Regx.DATE_REGX, customer.getBirth());
			flagEmail = analyze.analyzeCorrectness(Regx.EMAIL_REGX, customer.getEmial());
			if(flagDate&&flagEmail){
				newList.add(customer);
			}
		}
		return newList;
	}

}
